﻿using ParadoxNotion.Design;
using UnityEngine;
using Yoozoo.Gameplay.Liberty.AI.Utils;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    [Category("Ggame/Liberty")]
    public class NpcManualRVOAvoidPlayer : AIBaseNode
    {

        protected override void OnUpdate()
        {
            EndAction();
            return;
            var player = LibertyAIUtils.PlayerController.playerModel;

            Vector3 v1 = player.position - _entity.data.position;

            Vector3 v2 = Vector3.Project(v1, _entity.data.forward);

            Vector3 avoidV = (v2 - v1) + _entity.data.forward;

            //_entity.rvoController;

            _entity.rvoController.velocity = - avoidV.normalized * _entity.data.maxSpeed;

            // DEBUG
            if (_entity.data.npcStatus == NpcStatus.PathControl)
            {
                EndAction();
            }
        }
        
    }
}